# Raw HTML

Text between < and > that looks like an HTML tag is parsed as a raw HTML tag and will be rendered in HTML without escaping. Tag and attribute names are not limited to current HTML tags, so custom tags (and even, say, DocBook tags) may be used.
Here is the grammar for tags:
tag name (opens new window) consists of an ASCII letter followed by zero or more ASCII letters, digits, or hyphens (-).

An attribute (opens new window) consists of whitespace (opens new window), an attribute name (opens new window), and an optional attribute value specification (opens new window).

An attribute name (opens new window) consists of an ASCII letter, _, or :, followed by zero or more ASCII letters, digits, _.:, or -. (Note: This is the XML specification restricted to ASCII. HTML5 is laxer.)

An attribute value specification (opens new window) consists of optional whitespace (opens new window), a = character, optional whitespace (opens new window), and an attribute value (opens new window).

An attribute value (opens new window) consists of an unquoted attribute value (opens new window), a single-quoted attribute value (opens new window), or a double-quoted attribute value (opens new window).

An unquoted attribute value (opens new window) is a nonempty string of characters not including whitespace (opens new window)"'=<>, or `.

single-quoted attribute value (opens new window) consists of ', zero or more characters not including ', and a final '.

double-quoted attribute value (opens new window) consists of ", zero or more characters not including ", and a final ".

An open tag (opens new window) consists of a < character, a tag name (opens new window), zero or more attributes (opens new window), optional whitespace (opens new window), an optional / character, and a > character.

closing tag (opens new window) consists of the string </, a tag name (opens new window), optional whitespace (opens new window), and the character >.

An HTML comment (opens new window) consists of <!-- + text + -->, where text does not start with > or ->, does not end with -, and does not contain --. (See the HTML5 spec (opens new window).)

processing instruction (opens new window) consists of the string <?, a string of characters not including the string ?>, and the string ?>.

declaration (opens new window) consists of the string <!, a name consisting of one or more uppercase ASCII letters,whitespace (opens new window), a string of characters not including the character >, and the character >.

CDATA section (opens new window) consists of the string <![CDATA[, a string of characters not including the string ]]>, and the string ]]>.

An HTML tag (opens new window) consists of an open tag (opens new window), a closing tag (opens new window), an HTML comment (opens new window), a processing instruction (opens new window), a declaration (opens new window), or a CDATA section (opens new window).

Here are some simple open tags:

Example 632

Markdown HTML Demo
<a><bab><c2c>

<p><a><bab><c2c></p>

Empty elements:

Example 633

Markdown HTML Demo
<a/><b2/>

<p><a/><b2/></p>

Whitespace (opens new window) is allowed:

Example 634

Markdown HTML Demo
<a  /><b2
data="foo" >

<p><a  /><b2
data="foo" ></p>

With attributes:

Example 635

Markdown HTML Demo
<a foo="bar" bam = 'baz <em>"</em>'
_boolean zoop:33=zoop:33 />

<p><a foo="bar" bam = 'baz <em>"</em>'
_boolean zoop:33=zoop:33 /></p>

Custom tag names can be used:

Example 636

Markdown HTML Demo
Foo <responsive-image src="foo.jpg" />

<p>Foo <responsive-image src="foo.jpg" /></p>

Illegal tag names, not parsed as HTML:

Example 637

Markdown HTML Demo
<33> <__>

<p>&lt;33&gt; &lt;__&gt;</p>

Illegal attribute names:

Example 638

Markdown HTML Demo
<a h*#ref="hi">

<p>&lt;a h*#ref=&quot;hi&quot;&gt;</p>

Illegal attribute values:

Example 639

Markdown HTML Demo
<a href="hi'> <a href=hi'>

<p>&lt;a href=&quot;hi'&gt; &lt;a href=hi'&gt;</p>

Illegal whitespace (opens new window):

Example 640

Markdown HTML Demo
< a><
foo><bar/ >
<foo bar=baz
bim!bop />

<p>&lt; a&gt;&lt;
foo&gt;&lt;bar/ &gt;
&lt;foo bar=baz
bim!bop /&gt;</p>

Missing whitespace (opens new window):

Example 641

Markdown HTML Demo
<a href='bar'title=title>

<p>&lt;a href='bar'title=title&gt;</p>

Closing tags:

Example 642

Markdown HTML Demo
</a></foo >

<p></a></foo ></p>

Illegal attributes in closing tag:

Example 643

Markdown HTML Demo
</a href="foo">

<p>&lt;/a href=&quot;foo&quot;&gt;</p>

Comments:

Example 644

Markdown HTML Demo
foo <!-- this is a
comment - with hyphen -->

<p>foo <!-- this is a
comment - with hyphen --></p>

Example 645

Markdown HTML Demo
foo <!-- not a comment -- two hyphens -->

<p>foo &lt;!-- not a comment -- two hyphens --&gt;</p>

Not comments:

Example 646

Markdown HTML Demo
foo <!--> foo -->

foo <!-- foo--->

<p>foo &lt;!--&gt; foo --&gt;</p>
<p>foo &lt;!-- foo---&gt;</p>

Processing instructions:

Example 647

Markdown HTML Demo
foo <?php echo $a; ?>

<p>foo <?php echo $a; ?></p>

Declarations:

Example 648

Markdown HTML Demo
foo <!ELEMENT br EMPTY>

<p>foo <!ELEMENT br EMPTY></p>

CDATA sections:

Example 649

Markdown HTML Demo
foo <![CDATA[>&<]]>

<p>foo <![CDATA[>&<]]></p>

Entity and numeric character references are preserved in HTML attributes:

Example 650

Markdown HTML Demo
foo <a href="&ouml;">

<p>foo <a href="&ouml;"></p>

Backslash escapes do not work in HTML attributes:

Example 651

Markdown HTML Demo
foo <a href="\*">

<p>foo <a href="\*"></p>

Example 652

Markdown HTML Demo
<a href="\"">

<p>&lt;a href=&quot;&quot;&quot;&gt;</p>